﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Gmmy.Utility;
using Host.Dto;
using Surging.Core.CPlatform.Ioc;
using Surging.Core.CPlatform.Runtime.Server.Implementation.ServiceDiscovery.Attributes;
using Surging.Core.CPlatform.Support;
using Surging.Core.CPlatform.Support.Attributes;

namespace Host.Module
{
    [ServiceBundle("api/{Service}")]
    public interface IAuthService : IServiceKey
    {
        /// <summary>
        /// 登录认证
        /// </summary>
        /// <param name="requestData"></param>
        /// <returns></returns>
        [Command(Strategy = StrategyType.Injection, ExecutionTimeoutInMilliseconds = 30000, BreakerRequestVolumeThreshold = 3, Injection = @"return null;", RequestCacheEnabled = false)]
        Task<CustomApiResult> Authentication(AuthenticationRequestData input);

        /// <summary>
        /// 获取登陆者信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>

        [Command(Strategy = StrategyType.Injection, ExecutionTimeoutInMilliseconds = 30000, BreakerRequestVolumeThreshold = 3, Injection = @"return null;", RequestCacheEnabled = false)]
        Task<CustomApiResult> Info(AuthToken input);

        /// <summary>
        /// 授权校验
        /// </summary>
        /// <param name="input"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        [Command(Strategy = StrategyType.Injection, ExecutionTimeoutInMilliseconds = 30000, BreakerRequestVolumeThreshold = 3, Injection = @"return null;", RequestCacheEnabled = false)]
        Task<CustomApiResult> AuthorizationCheck(UserCheckDto input);

        /// <summary>
        /// 登出
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [Command(Strategy = StrategyType.Injection, ExecutionTimeoutInMilliseconds = 30000, BreakerRequestVolumeThreshold = 3, Injection = @"return null;", RequestCacheEnabled = false)]
        Task<CustomApiResult> Logout(AuthToken input);

        /// <summary>
        /// 更新用户缓存
        /// </summary>
        /// <param name="input"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        [Command(Strategy = StrategyType.Injection, ExecutionTimeoutInMilliseconds = 30000, BreakerRequestVolumeThreshold = 3, Injection = @"return null;", RequestCacheEnabled = false)]
        Task<CustomApiResult> UpdateToken(UpdateTokenDto input, string token);
    }
}
